package org.absolutezero.model;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.logging.Logger;






public class Generator {
	
	private Logger logger = Logger.getLogger(Generator.class.getName());
	private Random random;
	
	private String productNames =	"" +
			"untoasted muesli,Bran Buds,Just Right,Mini Wheats,Vitabrits," +
			"Nutrigrain,Sustain,Weetbix,Honey   Smacks,untoasted muesli," +
			"shredded wheat,Cornflakes,Sultana Bran,Branflakes,Cocopops," +
			"Puffed Wheat,Rice Bubbles,Rice Chex,Wheat bites,Breakfast bars," +
			"Oat in honey bake,Team,Total,wheat bites," +
			"corn branBurgen Oat bran bread (31) or multigrain bread or soy-linseed bread (19) or fruit bread," +
			" kibbled barley,Holsom's wholemeal,9 grain mutigrain," +
			"fruit loaf,pumpernickel,sourdough rye,stoneground wholemeal,Ploughmans loaf," +
			"Vogel Honey & Oat,Pita bread,croissant*,crumpet,white bread," +
			"hamburger bun,light rye bread,sourdough,rye,wholemeal bread," +
			"pizza,White,Bagels,waffles Wonderwhite,Dark Rye bread,French baguette," +
			"melba toast,Gluten-free bread,Crackers/Crispbreads/Biscuits/CakesJatz*," +
			"oatmeal,rich tea biscuits,banana cake,pound cake,apple muffin,sponge cake," +
			"Ryvita,Saos,Jatz,Breton wheat,stoned wheat thins,digestives,oatmeal, " +
			"milk arrowroot,shredded wheatmeals,shortbread,flans," +
			"angel food cake* muesli bars with fruit,bran muffins," +
			"Blueberry muffin,flaky pastry,Kavli,water crackers," +
			"rice cakes,pretzels,crackerbread,puffed crispbread," +
			"morning coffee,vanilla wafer,donuts (cinnamon)," +
			"Wheat pasta,noodles,egg fettucine,vermicelli," +
			"meat ravioli,macaroni,tortellini,spaghetti," +
			"long grain white rice,pearl barley,buckwheat," +
			"bulgur,semolina,cracked wheat,popcorn," +
			"Buckwheat,brown rice,Doongara,Basmati rice,taco shells,gnocchi,couscous," +
			"maize cornmeal,macaroni cheese (packet),Sunbrown quick rice,Calrose shortgrain rice," +
			"Instant cooked, tapioca,Corn chips,millet,rice pasta,Soya beans,kidney beans," +
			"lentils,butter beans,chick peas,haricot beans,lentils,baked beans,bengal gram," +
			"blackeyed beansall nutsGreen gram dahl,green pea soup,split pea soup,Broad beans," +
			"lima beans,pinto beans,Green peas,sweet corn,sweet potato,carrots," +
			"potato crisps*New canned potatoes,new potatoes,beetroot,French fries*," +
			"baked potatoes,pumpkin,parsnip,potatoes (Pontiac,Sebago,Desiree,instant)," +
			"Cherries,plums,grapefruit,peaches,apples,pears,dried  apricots,grapes,kiwi fruit," +
			"oranges,jam,Mango,paw paw,sultanas, bananas (just ripe),raisins,rockmelon,pineapple," +
			"fresh apricots,canned fruit in syrup,watermelon,very ripe medium fruits,Whole milk," +
			"skim milk,chocolate milk,low fat flavoured yoghurt,artificially sweetened yoghurt," +
			"low fat ice-cream*,custard,soy milkIcecream (full fat)," +
			"Tofu frozen dessertVitari frozen fruitFructose (fruit sugar)," +
			"NutellaLactose (milk sugar),Sucrose,honey,Glucose,Glucodin,jellybeans," +
			"lifesavers,maltose,Apple juice,grapefruit juice,orange juice,Sustagen," +
			"Cordial,Fanta,Lucozade,Gatorade,Sports Plus";	
	
	public Generator(){
		
		random = new Random();
		logger.info("Generator created");
	}
	
	public List<Product> generateProducts(int num){
		
		String[] names = productNames.split(",");
		Arrays.sort(names);
		
		List<Product> products = new ArrayList<Product>();
		for(int i=0;i<num;i++){
			
			Product p = new Product();
			p.setName(names[random.nextInt(names.length)]);
			p.setCalories(random.nextInt(2000));
			p.setCarbohydrate(random.nextInt(100));
			p.setFat(random.nextInt(100));
			p.setProtein(random.nextInt(100));
			p.setUnitWeight((long)random.nextInt(1000));
			p.setPriceForUnit(random.nextDouble()*10);
			
			products.add(p);
		}
		
		return products;
	}
	
}
